home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / auto2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  2.6 KB  |  110 lines

  1. //---------------------------------------------------------------------------
  2. // Borland C++Builder
  3. // Copyright (c) 1987, 1998 Borland International Inc.  All Rights Reserved.
  4. //---------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "auto2.h"
  10. #include "auto1.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13.  
  14. STDMETHODIMP TEditServerImpl::Clear()
  15. {
  16.   try
  17.   {
  18.     Form1->Edit1->Text="";
  19.   }
  20.   catch(Exception &e)
  21.   {
  22.     return Error(e.Message.c_str(), IID_IEditServer);
  23.   }
  24.   return S_OK;
  25. };
  26. //---------------------------------------------------------------------------
  27.  
  28. STDMETHODIMP TEditServerImpl::get_EditNum(int* Value)
  29. {
  30.   try
  31.   {
  32.     int val = atoi(Form1->Edit1->Text.c_str());
  33.    *Value = val;
  34.   }
  35.   catch(Exception &e)
  36.   {
  37.     return Error(e.Message.c_str(), IID_IEditServer);
  38.   }
  39.   return S_OK;
  40. };
  41. //---------------------------------------------------------------------------
  42.  
  43. STDMETHODIMP TEditServerImpl::get_EditStr(BSTR* Value)
  44. {
  45.   try
  46.   {
  47.      *Value = WideString(Form1->Edit1->Text).Detach();
  48.   }
  49.   catch(Exception &e)
  50.   {
  51.     return Error(e.Message.c_str(), IID_IEditServer);
  52.   }
  53.   return S_OK;
  54. };
  55. //---------------------------------------------------------------------------
  56.  
  57. STDMETHODIMP TEditServerImpl::set_EditNum(int Value)
  58. {
  59.   try
  60.   {
  61.      Form1->Edit1->Text = AnsiString(Value);
  62.   }
  63.   catch(Exception &e)
  64.   {
  65.     return Error(e.Message.c_str(), IID_IEditServer);
  66.   }
  67.   return S_OK;
  68. };
  69. //---------------------------------------------------------------------------
  70.  
  71. STDMETHODIMP TEditServerImpl::set_EditStr(BSTR Value)
  72. {
  73.   try
  74.   {
  75.     Form1->Edit1->Text = AnsiString(Value);
  76.   }
  77.   catch(Exception &e)
  78.   {
  79.     return Error(e.Message.c_str(), IID_IEditServer);
  80.   }
  81.   return S_OK;
  82. };
  83. //---------------------------------------------------------------------------
  84.  
  85. STDMETHODIMP TEditServerImpl::SetThreeStr(BSTR s1, BSTR s2, BSTR s3,
  86.   BSTR* result)
  87. {
  88.   try
  89.   {
  90.     WideString retval(s1);
  91.     retval += L" ";
  92.     retval += s2;
  93.     retval += L" ";
  94.     retval += s3;
  95.     Form1->Edit1->Text = retval;
  96.  
  97.     // Send out a copy of our concatenated BSTR
  98.     // NOTE: result is not an [in, out], so we're not responsible for freeing what was there before
  99.     *result = retval.Copy();
  100.   }
  101.   catch(Exception &e)
  102.   {
  103.     return Error(e.Message.c_str(), IID_IEditServer);
  104.   }
  105.   return S_OK;
  106. };
  107. //---------------------------------------------------------------------------
  108.  
  109.  
  110.